import React, { Component } from 'react'

export default class NewDetail extends Component {
  state = {
    id: '',
    name: ''
  }
  componentDidMount () {
    const searchParams = new URLSearchParams(this.props.location.search)

    const id = searchParams.get('id')
    const name = searchParams.get('name')
    console.log(id, name)

    this.setState({
      id,
      name
    })
  }
  render () {
    return (
      <div>
        NewDetail
        <p>
          {this.state.id}---{this.state.name}
        </p>
      </div>
    )
  }
}
